package com.gla.dao;

import com.gla.domain.Commodity;
import com.gla.domain.Shop;
import com.gla.domain.ShoppingCartItem;
import org.apache.ibatis.annotations.*;

import java.util.HashMap;
import java.util.List;

@Mapper
public interface ShoppingCartMapper {

    List<ShoppingCartItem> select(HashMap<String,Object> map);

    @Insert("INSERT INTO SHOPPINGCART(commodity_id, user_id, number) VALUES(#{commodity_id},#{user_id},#{number})")
    void insert(Integer commodity_id,Integer user_id,Integer number);

    @Delete("DELETE FROM SHOPPINGCART WHERE id=#{id}")
    void delete(Integer id);

    @Update("UPDATE SHOPPINGCART SET NUMBER=#{number} WHERE id=#{id}")
    void updateNumber(Integer id,Integer number);

    @Select("SELECT * FROM SHOP WHERE id=#{shop_id}")
    Shop selectShop(Integer shop_id);
}
